#include "AC_DFA.h"
#include <iostream>
#include <string>
using namespace std;

int main()
{
    AC_DFA dfa;
    cout<<sizeof(AC_DFA)<<endl;
    dfa.AddKeyword("app/*/a/b",2,3,NULL);
    dfa.AddKeyword("app/*/a/s",3,4,NULL);
	dfa.AddKeyword("app/bdfef/*aaa",4,5,NULL);
	dfa.AddKeyword("*abc",5,6,NULL);
    /*dfa.AddKeyword("aa",5,6,NULL);
    dfa.AddKeyword("bb",6,7,NULL);
    dfa.AddKeyword("aa",8,9,NULL);
    dfa.AddKeyword("AbcdEfg",9,10,NULL);
	*/
    dfa.ShowAll();
    dfa.BuildAll();

    int index=-1;
    char *p=dfa.Find("app/abcf23452134/a/sabdfbd",index);
    while(p)
    {
		while(index!=-1)
		{
			cout<<"Type:"<<dfa.GetType(index)<<"\tSubType:"<<dfa.GetSubType(index)<<endl;
			index=dfa.GetNext(index);
		}
		p=dfa.Find(p,index);
    }
/*
    string name="abcd\"\"";
    string::size_type b=name.find("\"");
    string::size_type e=name.find("\"",b+1);
    cout<<e-b<<endl;
    char buffer[256]={0};
    snprintf(buffer,sizeof(buffer),"%s.%d","first",1);
    snprintf(buffer,sizeof(buffer),"%s.%d","s",2);
    cout<<buffer<<endl;
	*/
}


